﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MTK_BieuThuc
{
    public class DivExpr:BinaryExpr
    {
        public DivExpr(Expression e1, Expression e2)
        {
            expr1 = e1;
            expr2 = e2;
        }
        public override double Evuluate(double x)
        {
            return expr2.Evuluate(x) / expr2.Evuluate(x);
        }
        public override Expression createDerive()
        {
            return new DivExpr(new SubExpr(new MulExpr(expr1.derive(), expr2), new MulExpr(expr1, expr2.derive())), new MulExpr(expr2, expr2));
        }
        public override string toString(StrategyString ss)
        {
            return ss.toString(this, expr1, expr2);
        }
        public override string getOperator()
        {
            return "/";
        }
    }
}
